<template>
  <div class="main">
    <el-container class="main-conent">
      <el-aside :width="!isCollapse ? '200px' : '60px'">
        <nav-menu :isCollapse="isCollapse" />
      </el-aside>
      <el-container class="page">
        <el-header class="page-header">
          <nav-header @foldChange="handleFoldChange" />
        </el-header>
        <el-main class="page-content">
          <div class="page-info">
            <router-view />
          </div>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import { NavMenu } from '@/components/nav-menu'
import { NavHeader } from '@/components/nav-header'

export default defineComponent({
  components: {
    NavMenu,
    NavHeader
  },
  setup() {
    const isCollapse = ref(false)

    const handleFoldChange = (isFold: boolean) => {
      isCollapse.value = isFold
    }

    return {
      isCollapse,
      handleFoldChange
    }
  }
})
</script>

<style scoped lang="less">
.main {
  width: 100%;
  height: 100vh;
  .main-conent {
    height: 100%;
    .el-aside {
      overflow: hidden;
      text-align: center;
      height: 100%;
      background-color: #001529;
    }
    .page {
      height: 100%;
      .page-header {
        display: flex;
        align-items: center;
      }
      .page-content {
        color: #333;
        text-align: center;
        background-color: #f0f2f5;
        .page-info {
          background-color: #fff;
          border-radius: 5px;
        }
      }
    }
  }
}
</style>
